import VueRouter from "vue-router";
import Vue from "vue";
import prRoutes from "./purchase-receipt";

Vue.use(VueRouter); // 还要use一下，啰嗦的一匹
const routes = [
  {
    path: "/",
    redirect: "/purchase/index",
    // redirect: "/login",
    beforeEnter: (to: any, from: any) => {
      console.log("独享守卫", to, from);
    },
  },
  {
    path: "/cms",
    component: () => import("@/views/Home.vue"),
    children: [...prRoutes],
  },
  {
    path: "/login",
    component: () => import("@/views/login/Login.vue"),
  },
  {
    path: "/h",
    component: () => import("@/components/Guide.vue"),
  },
];
const router = new VueRouter({
  mode: "history",
  routes,
});

export default router;
